package cn.com.dcsgo.dto;

import cn.com.dcsgo.model.ShopOrder;
import cn.com.dcsgo.validation.ValueOf;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 提交订单请求参数
 *
 * @author Dcsgo
 * @since 2025/11/18 10:14
 */
@Data
@Schema(description = "提交订单请求参数")
public class OrderSubmitDTO {
    /**
     * 默认收获地址
     */
    @NotNull(message = "收货地址不能为空")
    @Schema(description = "收货地址")
    private MemberAddressDTO memberAddr;
    /**
     * 店铺及其关联的商品信息列表
     */
    @NotEmpty(message = "店铺及其关联的商品信息列表不能为空")
    @Schema(description = "店铺及其关联的商品信息列表")
    private List<ShopOrder> shopOrders = new ArrayList<>(0);
    /**
     * 商品总数
     */
    @Schema(description = "商品总数")
    private Integer totalCount = 0;
    /**
     * 商品金额
     */
    @Schema(description = "商品金额")
    private BigDecimal totalMoney = BigDecimal.ZERO;
    /**
     * 实付金额
     */
    @Schema(description = "实付金额")
    private BigDecimal actualTotal = BigDecimal.ZERO;
    /**
     * 运费
     */
    @Schema(description = "运费")
    private BigDecimal transfee = BigDecimal.ZERO;
    /**
     * 折扣金额
     */
    @Schema(description = "折扣金额")
    private BigDecimal shopReduce = BigDecimal.ZERO;

    /**
     * 订单来源（0购物车，1直接购买商品）
     */
    @Schema(description = "订单来源（0购物车，1直接购买商品）")
    @NotNull(message = "订单来源不能为空")
    @ValueOf(value = {"0", "1"}, message = "订单来源只能为：0购物车，1直接购买商品")
    private Integer orderEntry;

    /**
     * 买家备注
     */
    @Schema(description = "买家备注")
    private String remarks;
}
